package io.springboot.jpa.examples.springbootjpaexamples.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author yzc
 * @description
 * @date 2018/9/10
 */
@Entity
@Table(name = "organization")
public class Organization extends BaseBean implements Serializable {
    private static final long serialVersionUID = -7997741669661118878L;

    private String name;
    private String code;
    private long superiorId;

    private Organization superior;
    private List<Organization> subsets = new ArrayList<>();

    @Column(name = "name", length = 50)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "code", length = 50)
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Column(name = "superior_id")
    public long getSuperiorId() {
        return superiorId;
    }

    public void setSuperiorId(long superiorId) {
        this.superiorId = superiorId;
    }

    @Transient
    public Organization getSuperior() {
        return superior;
    }

    public void setSuperior(Organization superior) {
        this.superior = superior;
    }

    @Transient
    public List<Organization> getSubsets() {
        return subsets;
    }

    public void setSubsets(List<Organization> subsets) {
        this.subsets = subsets;
    }
}
